﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CSharp1
{
    /// <summary>
    /// 通用类：手机类型
    /// </summary>
    public class TelePhone
    {
        /// <summary>
        /// 手机名字
        /// </summary>
        public string name;
        /// <summary>
        /// 手机品牌
        /// </summary>
        public string brand;
        /// <summary>
        /// 手机价格
        /// </summary>
        public float price;

        /// <summary>
        /// 手机电池
        /// </summary>
        public DianChi battery;

        /// <summary>
        /// 关于手机的信息
        /// </summary>
        public void AboutMe()
        {
            string info = string.Format("手机名字:{0}\r\n", name);
            info += string.Format("手机品牌:{0}\r\n", brand);
            info += string.Format("手机价格:{0}元", price);
            MessageBox.Show(info);
        }

        /// <summary>
        /// 手机开机
        /// </summary>
        public void PowerOn()
        {
            //判断是否有电池
            if (battery == null)
            {
                MessageBox.Show("没有电池");
            }
            else if (battery.dianLiang == 0)
            { //判断电池是否有电量
                MessageBox.Show("电量不足");
            }
            else
            {
                MessageBox.Show("开机中...");
            }
           
        }
    }
}
